package com.aurora.source.util.netutil;

import retrofit2.Retrofit;

/**
 * @author: Lance
 * @description: 将OkHttpClient和Retrofit结合好Retrofit对象 / Retrofit.create()返回一个泛型，完美结合RxJava,
 * @date: 2018/7/6 14:00
 */
public class RequestEngine {

    private static Retrofit sRetrofit;

    public RequestEngine() {
        sRetrofit = RetrofitUtil.getRetrofit();
    }

    /*public static RequestEngine getInstance() {
        if (instance == null) {
            synchronized (RequestEngine.class) {
                if (null == instance) {
                    instance = new RequestEngine();
                }
            }
        }
        return instance;
    }*/ // 以上是一般的方法引入的封装好的Retrofit，此处把代码注释掉是因为用到了注解Dagger2

    //返回一个泛型
    public <T> T getServer(Class<T> server) {
        return sRetrofit.create(server);
    }
}
